<template>
  <div class="w1 h1 guide-content">
    <Row class="w1 h1" type="flex" justify="space-between">
      <Col v-for="item in companyList" :key="index" :span="12" class="custom-mask-col">
      <div class="mask-detail" @click.stop.prevent="choseAcompany(item)" :title="item.name">
        <h2>{{item.name}}</h2>
      </div>
      </Col>
    </Row>
  </div>
</template>
<script>
import { getCompanyListByCity } from "@/api"
import { mapMutations } from "vuex"

export default {
  data() {
    return {
      companyList: []
    }
  },
  methods: {
    ...mapMutations(["SET_COMPANY_INFO"]),
    _getCompanyList() {
      let vm = this
      getCompanyListByCity({}).then(res => {
        if (res.code == 200) {
          vm.companyList = res.data
        }
      })
    },
    choseAcompany(item) {
      this.SET_COMPANY_INFO(item)
      this.$router.push("/")
    }
  },
  mounted() {
    let vm = this
    vm._getCompanyList()
  }
}
</script>
